Skip to content

feat: eliminate Editor.xib with programmatic NSWindow + SwiftUI root#238

Merged
2ndalpha merged 3 commits intomasterfrom
feat/eliminate-editor-xib
Mar 1, 2026
Merged

feat: eliminate Editor.xib with programmatic NSWindow + SwiftUI root#238
2ndalpha merged 3 commits intomasterfrom
feat/eliminate-editor-xib

Conversation

@2ndalpha
Copy link
Owner

@2ndalpha 2ndalpha commented Mar 1, 2026

Summary

New SwiftUI components

File Purpose
EditorView Root view with NavigationSplitView, owns @StateObject HostsDataStore
EditorToolbar 4 toolbar items (Create menu, Remove, Save, Activate) using SF Symbols
StatusBarView Files count label, read-only lock icon, busy spinner
EditorWindowPresenter @objc bridge creating NSWindow programmatically

Key changes

  • HostsDataStore converted from singleton to @StateObject-owned instance with deinit cleanup
  • Busy indicator moved from ApplicationController to HostsDataStore with thread-safe notification observers (queue: .main)
  • Toolbar Remove now uses moveToTrash:true (reversible, matches sidebar context menu)
  • Window lifecycle (open/close/reopen, dock show/hide) fully preserved
  • 28 ObjC files deleted (EditorController, ListController, Cell, Badge system, FilesCountTransformer, etc.)

Test changes

  • ApplicationControllerTests updated: NIB loading → EditorWindowPresenter.createEditorWindow()
  • HostsDataStoreTests updated: .shared singleton → HostsDataStore() instances, added busy state tests
  • New EditorWindowPresenterTests: window config, delegate, style mask (7 test cases)
  • 104 tests pass, 0 failures

Test plan

  • Build succeeds with no errors
  • All 104 unit tests pass
  • No dangling references to deleted files
  • Manual smoke test: launch app, select files, edit text, save, activate, create local/remote/combined, remove, rename, toggle combined picker, resize sidebar, close/reopen window, quit/relaunch
  • Verify SF Symbol toolbar icons render correctly
  • Verify status bar: files count, lock icon on read-only files, busy spinner during remote sync

2ndalpha added 3 commits March 1, 2026 08:55
…237)

Replace the 515-line Editor.xib and ~28 legacy ObjC files (~2800 LOC)
with a programmatic NSWindow containing a single SwiftUI EditorView
root. This is the final step (PR 3 of 3) in the editor modernization
series, following the sidebar (#234) and content area (#236) SwiftUI
migrations.

New SwiftUI components:
- EditorView: root view with NavigationSplitView, owns @StateObject
  HostsDataStore
- EditorToolbar: 4 toolbar items using SF Symbols (plus, minus,
  square.and.arrow.down, power)
- StatusBarView: files count label, read-only lock icon, busy spinner
- EditorWindowPresenter: @objc bridge creating NSWindow programmatically

Key changes:
- HostsDataStore converted from singleton to @StateObject-owned instance
- Busy indicator moved from ApplicationController to HostsDataStore with
  thread-safe notification observers (queue: .main)
- Toolbar Remove now uses moveToTrash:true (reversible) matching sidebar
- Window lifecycle (open/close/reopen, dock show/hide) preserved
The self.hostsGroups = self.hostsGroups line looks like a no-op but is
needed to trigger @published willSet since HostsGroup objects are
reference types whose property mutations don't change the array identity.
Resolve pbxproj conflicts from About box SwiftUI PR (#237):
- Remove files deleted by both branches (ExtendedNSTextView, NSToolbarPoofAnimator,
  HostsListView, ExtendedNSSplitView, AboutBoxController, ExtendedNSApplication)
- Keep new About box Swift files (AboutBoxView, AboutBoxPresenter)
- Fix UUID collision: About box files EE→FF prefix to avoid conflict
  with editor test file IDs
@2ndalpha 2ndalpha merged commit cd2f477 into master Mar 1, 2026
18 checks passed
@2ndalpha 2ndalpha deleted the feat/eliminate-editor-xib branch March 1, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant